package com.bilibili.juc.locks_2.demo_eight;

import java.util.concurrent.TimeUnit;

/**
 * 2 sendEmail方法中加入暂停3秒钟，请问先打印邮件还是短信
 *
 * @author 陈賝
 * @since 2024/5/28 15:27
 */
public class demo_2 {
    public static void main(String[] args)//一切程序的入口
    {
        Phone phone = new Phone();

        new Thread(() -> {
            phone.sendEmail();
        },"a").start();

        //暂停毫秒,保证a线程先启动
        try { TimeUnit.MILLISECONDS.sleep(200); } catch (InterruptedException e) { e.printStackTrace(); }

        new Thread(() -> {
            phone.sendSMS();
        },"b").start();
    }
}
//-----sendEmail
//-----sendSMS
